function AppCtrl($scope, log) {
    $scope.show = false;
    $scope.counter = 0;
    
    $scope.$on('startAsync', function () {
        $scope.counter++;
        
        if ($scope.counter > 0) {
            $scope.show = true;
        }
    });

    $scope.$on('endAsync', function () {
        $scope.counter--;
        
        if ($scope.counter == 0) {
            $scope.show = false;
        }
    });
};